#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

static bool prime(int n) {
    if (n < 2) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;

    for (int i = 3; i * i <= n; i += 2) {
        if (n % i == 0) 
            return false;
    }

    return true;
}

int main() {
    constexpr int target = 800800;
    constexpr double lim = target * log(target);
    vector<int> primes {2};
    for (int i = 3; i * log(2) + 2 * log(i) <= lim; i += 2) {
        if (prime(i))
            primes.push_back(i);
    }

    int ans = 0;
    for (int i = 0; i < primes.size(); ++i) {
        if (2 * primes[i] * log(primes[i]) > lim)
            break;

        for (int j = i + 1; j < primes.size(); ++j) {
            int p = primes[i];
            int q = primes[j];
            double tmp = q * log(p) + p * log(q);
            if (tmp <= lim)
                ++ans;
            else
                break;
        }
    }
    cout << ans << endl;
}